package com.xiaoshuidi.cloud.module.finance.api.order;

import com.xiaoshuidi.cloud.framework.common.pojo.CommonResult;
import com.xiaoshuidi.cloud.module.finance.api.order.dto.PayOrderCreateReqDTO;
import com.xiaoshuidi.cloud.module.finance.api.order.dto.PayOrderRespDTO;
import com.xiaoshuidi.cloud.module.finance.enums.ApplicationConstants;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;

/**
 * 支付单 API 接口
 */
@FeignClient(name = "lease-finance-server")
@Tag(name = "RPC 服务 - 支付订单")
public interface PayOrderApi {

    /**
     * 创建支付单
     *
     * @param reqDTO 创建请求
     * @return 支付单编号
     */
    @PostMapping(ApplicationConstants.PREFIX + "/pay/order/create")
    CommonResult<Long> createOrder(@Valid @RequestBody PayOrderCreateReqDTO reqDTO);

    /**
     * 获得支付单
     *
     * @param id 支付单编号
     * @return 支付单
     */
    @GetMapping(ApplicationConstants.PREFIX + "/pay/order/{id}")
    PayOrderRespDTO getOrder(@PathVariable("id") Long id);

}
